﻿<%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Schedule.aspx.cs"
    Theme="DXConnect" Inherits="Schedule" %>
<%@ Register assembly="DevExpress.XtraScheduler.v12.1.Core, Version=12.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.XtraScheduler" tagprefix="cc1" %>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <div class="mainContent schedulerTab">
        <div class="contentHeader">
            <div class="content">
                <img id="scheduleTitle" src="Images/title_schedule.png" alt="Schedule" />
            </div>
        </div>
        <div class="content">
            <div class="dxConnectScheduler">
<asp:SqlDataSource ID="resourceSqlDataSource" runat="server" 
    ConnectionString="<%$ ConnectionStrings:CocShopDatabaseConnectionString %>" 
    SelectCommand="SELECT [ProductID], [Model] FROM [Product]">
</asp:SqlDataSource>

                <asp:SqlDataSource ID="appointmentSqlDataSource" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:CocShopDatabaseConnectionString %>" 
                    DeleteCommand="DELETE FROM [OrderScheduling] WHERE [OrderID] = @OrderID" 
                    InsertCommand="INSERT INTO [OrderScheduling] ([ProductID], [SupplierID], [Subject], [Description], [Location], [Quantity], [StartDate], [EndDate]) VALUES (@ProductID, @SupplierID, @Subject, @Description, @Location, @Quantity, @StartDate, @EndDate)" 
                    SelectCommand="SELECT * FROM [OrderScheduling]" 
                    UpdateCommand="UPDATE [OrderScheduling] SET [ProductID] = @ProductID, [SupplierID] = @SupplierID, [Subject] = @Subject, [Description] = @Description, [Location] = @Location, [Quantity] = @Quantity, [StartDate] = @StartDate, [EndDate] = @EndDate WHERE [OrderID] = @OrderID">
                    <DeleteParameters>
                        <asp:Parameter Name="OrderID" Type="Int32" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="ProductID" Type="Int32" />
                        <asp:Parameter Name="SupplierID" Type="Int32" />
                        <asp:Parameter Name="Subject" Type="String" />
                        <asp:Parameter Name="Description" Type="String" />
                        <asp:Parameter Name="Location" Type="String" />
                        <asp:Parameter Name="Quantity" Type="Int32" />
                        <asp:Parameter DbType="Date" Name="StartDate" />
                        <asp:Parameter DbType="Date" Name="EndDate" />
                    </InsertParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="ProductID" Type="Int32" />
                        <asp:Parameter Name="SupplierID" Type="Int32" />
                        <asp:Parameter Name="Subject" Type="String" />
                        <asp:Parameter Name="Description" Type="String" />
                        <asp:Parameter Name="Location" Type="String" />
                        <asp:Parameter Name="Quantity" Type="Int32" />
                        <asp:Parameter DbType="Date" Name="StartDate" />
                        <asp:Parameter DbType="Date" Name="EndDate" />
                        <asp:Parameter Name="OrderID" Type="Int32" />
                    </UpdateParameters>
                </asp:SqlDataSource>
                <dx:ASPxScheduler ID="myScheduler" runat="server" 
                    AppointmentDataSourceID="appointmentSqlDataSource" ClientIDMode="AutoID" 
                    ResourceDataSourceID="resourceSqlDataSource" Start="2012-07-26">
                    <Storage>
                        <Appointments>
                            <Mappings AppointmentId="OrderID" Description="Description" End="EndDate" 
                                Location="Location" ResourceId="ProductID" Start="StartDate" 
                                Subject="Subject" />
                            <CustomFieldMappings>
                                <dx:ASPxAppointmentCustomFieldMapping Member="Quantity" Name="Quantity" />
                                <dx:ASPxAppointmentCustomFieldMapping Member="SupplierID" Name="SupplierID" />
                            </CustomFieldMappings>
                        </Appointments>
                        <Resources>
                            <Mappings Caption="Model" ResourceId="ProductID" />
                        </Resources>
                    </Storage>
<Views>
<DayView><TimeRulers>
<cc1:TimeRuler></cc1:TimeRuler>
</TimeRulers>
</DayView>

<WorkWeekView><TimeRulers>
<cc1:TimeRuler></cc1:TimeRuler>
</TimeRulers>
</WorkWeekView>
</Views>

<ClientSideEvents MouseUp=""></ClientSideEvents>
                    <OptionsCustomization AllowAppointmentCopy="None" AllowAppointmentCreate="None" 
                        AllowAppointmentEdit="None" AllowDisplayAppointmentForm="Never" 
                        AllowInplaceEditor="None" />
                </dx:ASPxScheduler>
            </div>
        </div>
    </div>
    <asp:ObjectDataSource ID="AppointmentDataSource" runat="server" DataObjectTypeName="Session"
        TypeName="SessionDataSource" SelectMethod="SelectMethodHandler" InsertMethod="InsertMethodHandler"
        UpdateMethod="UpdateMethodHandler" OnObjectCreated="appointmentsDataSource_ObjectCreated"
        OnInserted="appointmentsDataSource_Inserted" />
                    <dx:ASPxHyperLink runat="server" Cursor="pointer" NavigateUrl="~/NewOrder.aspx"
                CssClass="createNewOrder" ImageUrl="~/Images/addOrder.png" 
        Target="_blank" ID="createNewOrderHyperLink" />
            
            </asp:Content>
